<?php
error_reporting(0);
include_once '../classes/Authentication.php';
include_once '../classes/HTML.php';
session_start ();
$auth = new Authentication ();
$auth->checkAuthentication ($_SERVER['PHP_SELF'], 2);
HTML::createHeader('Offene Tickets', '');
$db = new DB_For_User();
?>
<body>
	<?php HTML::createLogobar($auth->getUser());?>
	<div class="container">
		<div class="row">
			<div class="col-md-3">
				<h3>Ticket bearbeiten</h3>   
          		<p>Hier k&ouml;nnen Sie ausgewählte Tickets bearbeiten:</p>
          		<p><a class="btn btn-default" href="tickets_edit.php" role="button">Tickets bearbeiten &raquo;</a></p>
			</div>
			<div class="col-md-4">
				<h2>Offene Tickets</h2>
				<table class="table table-hover table-condensed">
				<tr>
					<th>Titel</th>
					<th>Kategorie</th>
					<th>Priotit&auml;t</th>
					<th>Status</th>
					<th>&nbsp;</th>
				</tr>
				<?php
					$tickets = $db->getAllOpenTickets();
					foreach($tickets as $ticket) {
						echo $ticket->getTicketHtmlTable();
						echo '<td><a data-toggle="tooltip" title="&Uuml;bernehmen Sie dieses Ticket" href=# onclick="if(confirm('; echo "'Sind Sie sicher?'"; echo ')) {'; echo "document.location.href='/tickets_take.php?id=" . $ticket->getId() . "&user_id=" . $_SESSION['user_ID'] . "';}"; echo '"><span class="glyphicon glyphicon-wrench"></span></a></td></tr>';
					}
				?>
				</table>
			</div>
		</div>
		<?php HTML::createFooter();?>
	</div>
	<?php HTML::includeJS();?>
</body>
</html>